<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>案件材料汇总系统</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
    <header>
        <h1>📋 案件材料汇总系统</h1>
    </header>

    <main>
        <!-- 案件基本信息 -->
        <section class="card">
            <h2>📄 案件基本信息</h2>
            <div class="form-grid">
                <div class="form-item">
                    <label>闪送员姓名 <span class="required">*</span></label>
                    <input type="text" id="deliveryName" required>
                </div>
                <div class="form-item">
                    <label>三者姓名</label>
                    <input type="text" id="thirdPartyName">
                </div>
                <div class="form-item">
                    <label>案件类型 <span class="required">*</span></label>
                    <select id="caseType" required>
                        <option value="">请选择</option>
                        <option value="伤残">伤残</option>
                        <option value="死亡">死亡</option>
                    </select>
                </div>
                <div class="form-item">
                    <label>发案日期 <span class="required">*</span></label>
                    <input type="date" id="caseDate" required>
                </div>
                <div class="form-item">
                    <label>结案日期</label>
                    <input type="date" id="closeDate">
                </div>
                <div class="form-item">
                    <label>所属城市 <span class="required">*</span></label>
                    <input type="text" id="city" placeholder="例如：北京市" required>
                </div>
                <div class="form-item">
                    <label>案件责任人 <span class="required">*</span></label>
                    <input type="text" id="caseHandler" required>
                </div>
                <div class="form-item full">
                    <label>案件描述 <span class="required">*</span></label>
                    <textarea id="caseDesc" rows="4" required></textarea>
                </div>
            </div>
        </section>

        <!-- 材料目录 -->
        <section class="card">
            <h2>📂 材料目录</h2>
            <div id="materialsList"></div>
        </section>

        <!-- 字体设置 -->
        <section class="card">
            <h2>🔤 字体设置（可选）</h2>
            <div class="font-upload-section">
                <p class="font-hint">
                    💡 为了加快生成速度，推荐上传本地字体文件（Windows自带字体）：<br>
                    • <strong>微软雅黑</strong>：C:\Windows\Fonts\msyh.ttc<br>
                    • <strong>宋体</strong>：C:\Windows\Fonts\simsun.ttc<br>
                    不上传则自动从网络加载字体（可能较慢）
                </p>
                <div class="form-item">
                    <label>本地字体文件 (.ttf / .ttc / .otf)</label>
                    <input type="file" id="localFont" accept=".ttf,.ttc,.otf" onchange="handleFontUpload(this)">
                    <span id="fontStatus" class="font-status"></span>
                </div>
            </div>
        </section>

        <!-- 操作按钮 -->
        <div class="actions">
            <button class="btn btn-primary" onclick="generatePDF()">📄 生成PDF</button>
        </div>
    </main>

    <!-- 进度弹窗 -->
    <div id="progressModal" class="modal">
        <div class="modal-content">
            <h3>正在生成PDF...</h3>
            <div class="progress-bar">
                <div id="progressFill"></div>
            </div>
            <p id="progressText">准备中...</p>
        </div>
    </div>
</div>

<!-- 引入库 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf-lib/1.17.1/pdf-lib.min.js"></script>
<script src="https://unpkg.com/@pdf-lib/fontkit@1.1.1/dist/fontkit.umd.min.js"></script>

<!-- 引入项目JS -->
<script src="js/config.js"></script>
<script src="js/utils.js"></script>
<script src="js/form.js"></script>
<script src="js/file.js"></script>
<script src="js/pdf.js"></script>
<script src="js/main.js"></script>
</body>
</html>